package com.autocloud.model.security;

import com.autocloud.model.Base;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;

/**
 * @author zhongwb
 * @version 1.0
 * @description
 * @date 2019/12/3 8:44 下午
 */
@Entity
@Table(name = "sys_security_data_filtering")
@Data
@Accessors(chain = true)
public class DataFiltering extends Base {

    /**
     * 规则路径
     */
    private String action;
    /**
     * 匹配路径
     */
    private String matchurl;
    /**
     * 参数,优先识别路径参数.
     */
    private String param;
    /**
     * 验证脚本
     */
    @Lob
    @Column(columnDefinition = "TEXT")
    private String script;
    /**
     * 无效
     */
    @Column
    private String invalid;

    public static DataFiltering of(String title, String action, String matchurl, String param, String script, String id) {
        DataFiltering o = new DataFiltering();
        o.setTitle(title);
        o.setAction(action);
        o.setMatchurl(matchurl);
        o.setParam(param);
        o.setScript(script);
        o.setId(id);
//        o.setInvalid(FormField.Whether.isfalse.getName());
        return o;
    }

}
